//
//  STLogCell.swift
//  iPhone
//
//  Created by Toj on 8/28/23.
//

import UIKit

// MARK: - 懒加载(属性), 变量, 初始化init
class STLogCell: UITableViewCell {
    
    var log: String = "" { didSet {
        logLabel.text = log
    } }
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)

        setupMakeInitialize()
        setupMakeAddSubviews()
        setupMakeLayoutSubviews()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    /* <#NOTE#> */
    private(set) lazy var logLabel: UILabel = {
        let view = UILabel()
        view.textColor = .white
        view.font = 13.to_systemFont
        return view
    }()
    
    deinit {
        print("-->toj: \(cm_className) func: deinit")
    }
}

// MARK: - 初始化设置
private extension STLogCell {
    
    func setupMakeAddSubviews() {
        contentView.addSubview(logLabel)
    }
    
    func setupMakeLayoutSubviews() {
        logLabel.snp.makeConstraints { make in
            make.top.bottom.equalTo(contentView)
            make.left.right.equalTo(contentView).inset(5)
        }
    }
    
    func setupMakeInitialize() {
        contentView.backgroundColor = .black
    }
}
